# encoding: utf-8
""" 
@version: v1.0 
@author: autumner 
@license: Apache Licence  
@contact: 18322313385@163.com 
@site:  https://gitee.com/autumner/pythoncookbook
@software: PyCharm 
@file: net_resty_visit.py 
@time: 2019/7/12 上午10:03
"""
'''
通过使用urllib访问resty服务
'''
from urllib.request import urlopen


u = urlopen('http://localhost:8080/hello?name=Tom')
print(u.read().decode('utf-8'))

u = urlopen('http://localhost:8080/localtime')
print(u.read().decode('utf-8'))

print("在浏览器中直接输入'http://localhost:8080/hello?name=Tom'或'http://localhost:8080/localtime'也可以的")